<?php $this->load->view('inc/header'); ?>

<script type="text/javascript">
$(document).ready(function()
{
	$(window).load(function ()
	{
		$("#add_org_panel").hide();
		for(var i=0;i<=100;i++){
			$("#update"+i).hide();
		}
	}
	);
	
	$("#add_org_but").click(function ()
	{
		$("#add_org_panel").toggle();
	}
	);
	
}
);

function showUpdate(i)
{	
	$("#update"+i).toggle();
}
</script>
<!--content1-->
<div class="grid_12" style="background-color:#CCCCCC;">
<!--เมนูข้าง-->
<div class="grid_4 alpha" style="margin-top:10px;">
<div id="side-panel-top">
<div style="padding-left: 22px; padding-top: 11px; font-weight: bold;   color:#FF9933; text-shadow: 1px 1px 1px rgb(255, 255, 255);">Management</div>
</div>
<div id="side-panel-middle" style="padding-left: 22px;"><ul id="browser" class="filetree">
<li class="closed"><img src="<?=base_url()?>images/graphic/sitemap-application-blue.png" /> <span>Organization</span>
<ul>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/users.png" /><span> <a href="<?=base_url()?>administrator/org/manage-staff">Manage Staff</a></span></li>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/folder-open-document.png" /><span> <a href="<?=base_url()?>administrator/org/manage-news">Manage Content</a></span></li>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/table-sum.png" /><span> <a href="<?=base_url()?>administrator/org/statistics">Statistics</a></span></li>
</ul>
</li>
<li class="closed"><img src="<?=base_url()?>images/graphic/balloon-twitter-retweet.png" /> <span>CopS</span>
<ul>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/link.png" /><span> Manage Staff</span></li>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/folder-open-document.png" /><span> Manage Content</span></li>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/table-sum.png" /><span> Statistics</span></li>
</ul>
</li>
<li class="closed"><img src="<?=base_url()?>images/graphic/balloon-quotation.png" /> <span>Blogs</span>
<ul>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/link.png" /><span> Manage Staff</span></li>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/folder-open-document.png" /><span> Manage Content</span></li>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/table-sum.png" /><span> Statistics</span></li>
</ul>
</li>
<li class="closed"> this is closed! <img src="<?=base_url()?>images/folder.gif" />
<ul>
<li><img src="<?=base_url()?>images/file.gif" /></li>
</ul>
</li>
<li><img src="<?=base_url()?>images/file.gif" /></li>
</ul></div>
<div id="side-panel-bottom"></div>
<!--เมนูข้าง-->
<div class="grid_4 alpha" style="margin-top:8px;">
<div id="side-panel-top">
<div style="padding-left: 22px; padding-top: 11px; font-weight: bold;   color:#FF9933; text-shadow: 1px 1px 1px rgb(255, 255, 255);">Search</div>
</div>
<div id="side-panel-middle"> dsf</div>
<div id="side-panel-bottom"></div>
</div>
<!--ปิดเมนูข้าง-->
</div>
<!--ปิดเมนูข้าง-->
<div class="grid_8 omega" style="margin-top:10px;">
<div id="km-topic">
<div style="padding-left: 19px; padding-top: 11px; color: rgb(0, 0, 0); font-weight: bold; text-shadow: 1px 1px 1px rgb(255, 255, 255);">Administrator</div>
</div>
<div id="km-new-middle" style="height:auto;">
<div id="s_header" style="width:550px;"><h3>Organization Control</h3><hr/></div>
<div id = "add_org_but" style="-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 3px;
-moz-border-radius-bottomright: 10px;
-moz-border-radius-bottomleft: 3px;
border-top-left-radius: 10px;
border-top-right-radius: 3px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 3px; background:#66CC33; padding:5px; width:100px; color:#FFFFFF; cursor:pointer;">Add Organization</div>
<br/>
<div id="list_organization">
<ol>
          <?php 
		  	//$this->db->join('membership','membership.member_id=organization.staff_id');
			$i=0;
			$query = $this->db->get('organization');
			foreach($query->result() as $rows)
			{
				$org_id = $rows->org_id;
				$org_name = $rows->org_name;
				$org_description = $rows->org_description;
				$staff_id = $rows->staff_id;
				$i++;
		?>
          <li style="background-color:#F2F2F2; padding:10px; width:540px;"><img src="<?=base_url()?>images/arrow-bullet.jpg"/>&nbsp;
            <?=$org_name?>
            <span id="organization_desc">&nbsp;(
            <?=$org_description?>
            )&nbsp;<span onclick="showUpdate(<?=$i?>)" style="cursor:pointer;"><img src="<?=base_url()?>images/graphic/pencil.png"/></span>
            <hr/>
            
            <span id="update<?=$i?>"><label>Organization: </label><form method="post" action="<?=base_url()?>administrator/edit_organization"><input type="text" name="e_org_name" value="<?=$org_name?>"><label> Description: </label><input name="e_org_desc" type="text" value="<?=$org_description?>" size="30"> <input type="hidden" name="e_org_id" value="<?=$org_id?>" id="e_org_id"><input type="submit" value="Edit"></form>
            </span>
            </span>
            
            </li>
          <div id="spacer">&nbsp;</div>
          <?php
			} //end foreach
		?>
        <li id="add_org_panel" style="background-color:#F2F2F2; padding:10px; width:540px;"><img src="<?=base_url()?>images/arrow-bullet.jpg"/>&nbsp;Add Organization
         <hr/>
            <form method="post" action="<?=base_url()?>administrator/add_organization">
            	<label>Organization Name: </label><input name="org_name" type="text" id="org_name" size="35" maxlength="100"/>
                <br/><br/>
                <label>Description:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label><input name="org_desc" type="text" id="org_desc" size="50" maxlength="150"/>
                <input type="submit" name="add_org" id="add_org" value="Submit" />
            </form>
        </li>
        </ol>
</div>
</div>
<div id="km-new-bottom"></div>
</div>
</div>
<div class="clear"></div>
<!--end content1-->
<div class="grid_12" style="background-color:#CCCCCC;">&nbsp;</div>
<div class="clear"></div>
<?php $this->load->view('inc/footer'); ?>